import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Home from '../page/home'
import Mine from '../page/mine'
import Login from '../page/login'
import Group from '../page/groups/group'
import Detail from '../page/detail'
Vue.use(Router) 

export default new Router({
  routes: [
    {
      path:'/',
      redirect:{name:"Login"}  //写name的时候
      //另一种写法
    // { path: '/', redirect: '/Login' }  //另外一种写法
    },
    {
      path: '/home',
      name: 'Home',
      component: Home,
      children:[
        {
          path:"detail",
          name:"Detail",
          component:Detail
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/mine',
      name: 'Mine',
      component: Mine
    },
    {
      path: '/group',
      name: 'Group',
      component: Group
    },
    {
      path: "*",
      // 代表没有匹配上的时候 去重定向
      redirect:"/home"
    }
  ]
})
